package com.behelpful.demo.search.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.behelpful.demo.search.seriation.LocalDateTimeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.behelpful.demo.search.annotations.ISearchDocument;
import com.behelpful.demo.search.model.ISearchModel;
import com.behelpful.demo.search.model.test.GeoModel;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * TableName(value = "test_table_name")--> Binlog 对应数据库的表
 * ISearchDocument(indexName = "test_es_info") --> 对应 ES 的索引
 *
 * @author Alay
 * @date 2021-04-19 17:37
 */
@Data
@TableName(value = "test_table_name")
@ISearchDocument(indexName = "test_es_info")
public class TestEsInfo extends ISearchModel {
    /**
     * 主键id
     */
    private String id;
    /**
     * 名称
     */
    private String name;

    /**
     * 地区
     */
    private String address;
    /**
     * 坐标位置
     */
    private GeoModel location;

    /**
     * 更新时间
     */
    @JsonAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime updateTime;
    /**
     * 创建时间
     */
    @JsonAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime createTime;

    @Override
    public String getEsId() {
        return id;
    }
}